package cn.boat.router.broker.partition;

import cn.boat.router.broker.Message;
import cn.boat.router.exception.BoatMQException;

import java.util.List;
import java.util.Random;

/**
 * 随机选择器
 */
public class RandomPartitionSelector extends AbstractPartitionSelector{
    private Random random = new Random();
    @Override
    public Partition getPartiton0(String topic, List<Partition> partitions, Message message) throws BoatMQException {
        return partitions.get(random.nextInt(partitions.size()));
    }
}
